//
//  ZCHarmClassifyCell.m
//  zctx
//
//  Created by apple on 16/3/16.
//  Copyright © 2016年 sanliang. All rights reserved.
//

#import "ZCHarmClassifyCell.h"

@implementation ZCHarmClassifyCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"#f1f1f1"];
        self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
        self.selectedBackgroundView.backgroundColor = [UIColor whiteColor];
        [self addTitleLable];
        [self addSelectView];
    }
    return self;
}

-(void)addTitleLable{
    [self.contentView addSubview:self.titleLable];
    [self.titleLable makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).with.offset(19);
        make.centerY.equalTo(self.centerY).with.offset(0);
        make.centerX.equalTo(self.centerX).with.offset(0);
        make.height.mas_equalTo(21);
    }];
}

-(void)addSelectView{
    [self.contentView addSubview:self.selectView];
    [self.selectView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).with.offset(0);
        make.centerY.equalTo(self.centerY).with.offset(0);
        make.top.equalTo(self).with.offset(0);
        make.width.mas_equalTo(5);
    }];
}

-(void)setSelected:(BOOL)selected animated:(BOOL)animated{
    [super setSelected:selected animated:animated];
    if (selected) {
        self.titleLable.textColor = [UIColor colorWithHexString:@"#03ab9e"];
        self.selectView.backgroundColor = MainColor;
    }else{
        self.titleLable.textColor = [UIColor colorWithHexString:@"#000000"];
        self.selectView.backgroundColor = [UIColor colorWithHexString:@"#f1f1f1"];
    }
    
}

-(UILabel *)titleLable{
    if (!_titleLable) {
        _titleLable = [[UILabel alloc]initWithFrame:CGRectZero];
        _titleLable.font = [UIFont systemFontOfSize:14];
        _titleLable.textColor = [UIColor colorWithHexString:@"#000000"];
    }
    return _titleLable;
}

-(UIView *)selectView{
    if (!_selectView) {
        _selectView = [[UIView alloc]initWithFrame:CGRectZero];
        
    }
    return _selectView;
}

@end
